< previous page page_178 next page >

Page 178
0178-01.jpg
Figure 6.6
Program Contrast increasing an image's contrast.
Note that the stretching operation has introduced gaps in the histograms. If you look closely at the enhanced picture, you may be able to see small jumps in color values where the image should probably be smooth. Increasing the image's contrast sometimes creates this kind of discontinuity.
If you increase the contrast further, this effect becomes stronger. In Figure 6.7, program Contrast has spread the image's component values out so that they span 1000 values. Many of these values lie outside the allowed range of 0 to 255, so those values are changed to 0 or 255. That makes many pixels black or white. The large gaps in the component histograms reflect the large jumps in color in the new image.
Program Contrast uses subroutine ShowHistograms, shown in the following code, to create color histograms for an image. Subroutine TransformImage changes the image's color components to adjust its contrast.
' Show the component histograms.
Private Sub ShowHistograms(ByVal picImage As PictureBox, _
    ByVal save_min_max As Boolean)
Dim counts(0 To 2, 0 To 255) As Long
Dim max_count As Long
Dim brightness As Integer
Dim pixels() As RGBTriplet
Dim bits_per_pixel As Integer
Dim X As Integer
Dim Y As Integer
Dim i As Integer
Dim j As Integer

 
< previous page page_178 next page >